# Top-level makefile for jGL

# jGL 3D Graphics Library for Java
# Version:  2.4
# Copyright (C) 1996-2006  Robin Bing-Yu Chen

### Local Setting ###

VERSION = 2.4
HOMEDIR = /home/robin
BACKDIR = $(HOMEDIR)/work
HTMLDIR = $(HOMEDIR)/public_html/jGL

LOCALCLASSPATH = ..

FILES = GL GLU GLAUX GLUT GLE GLJ3D \
	GLCanvas GLApplet

### RULES ###

.SUFFIXES: .java

.java:
	@echo "Compile" $<
	@$(JAVAC) $(FLAGS) -classpath $(LOCALCLASSPATH) $<

### TARGETS ###

all:	$(FILES)
	@cd context ; $(MAKE) $@
	@cd glu ; $(MAKE) $@
	@cd glut ; $(MAKE) $@
	@cd glaux ; $(MAKE) $@
	@cd gle ; $(MAKE) $@
	@cd glj3d ; $(MAKE) $@
#	The following lines are for Cygwin, since the file name is the same as the directory name
	@if [ ! -f GLU.class ]; then $(JAVAC) -classpath $(LOCALCLASSPATH) GLU.java; fi
	@if [ ! -f GLUT.class ]; then $(JAVAC) -classpath $(LOCALCLASSPATH) GLUT.java; fi
	@if [ ! -f GLAUX.class ]; then $(JAVAC) -classpath $(LOCALCLASSPATH) GLAUX.java; fi
	@if [ ! -f GLE.class ]; then $(JAVAC) -classpath $(LOCALCLASSPATH) GLE.java; fi
	@if [ ! -f GLJ3D.class ]; then $(JAVAC) -classpath $(LOCALCLASSPATH) GLJ3D.java; fi
	@$(MAKE) update
	@cd Example ; $(MAKE) $@
	@cd Example-glut ; $(MAKE) $@
	@cd Example-app ; $(MAKE) $@
	@cd Example-gle ; $(MAKE) $@
	@cd glut-test ; $(MAKE) $@
	@echo "Compile jGL ok."

# docs:
#	@$(JAVADOC) -locale en_US -d doc -public -version -author *.java

clean:
	@cd context ; $(MAKE) $@
	@cd glu ; $(MAKE) $@
	@cd glut ; $(MAKE) $@
	@cd glaux ; $(MAKE) $@
	@cd gle ; $(MAKE) $@
	@cd glj3d ; $(MAKE) $@
	@cd Example ; $(MAKE) $@
	@cd Example-glut ; $(MAKE) $@
	@cd Example-app ; $(MAKE) $@
	@cd Example-gle ; $(MAKE) $@
	@cd glut-test ; $(MAKE) $@
	@$(RM) *.class core

update:
	@if [ -f Example/jgl.jar ]; then $(RM) Example/jgl.jar; fi
	@cd .. ; $(JAR) jgl/Example/jgl.jar jgl/*.class \
					    jgl/glu/*.class \
					    jgl/glut/*.class \
					    jgl/glaux/*.class \
					    jgl/gle/*.class \
					    jgl/gle/geometry/*.class \
					    jgl/gle/render/*.class \
					    jgl/glj3d/*.class \
					    jgl/context/*.class \
					    jgl/context/attrib/*.class \
					    jgl/context/attrib/eval/*.class \
					    jgl/context/attrib/lighting/*.class \
					    jgl/context/attrib/pixel/*.class \
					    jgl/context/attrib/texture/*.class \
					    jgl/context/clipping/*.class \
					    jgl/context/geometry/*.class \
					    jgl/context/render/*.class \
					    jgl/context/render/pixel/*.class
	@$(CP) Example/jgl.jar Example-glut
	@$(CP) Example/jgl.jar Example-app
	@$(CP) Example/jgl.jar Example-gle
	@$(CP) Example/jgl.jar glut-test

html:
#	@$(CP) Example/jgl.jar $(HTMLDIR)/pub
	@if [ -f $(HTMLDIR)/pub/jgl.jar ]; then $(RM) $(HTMLDIR)/pub/jgl.jar; fi
	@cd .. ; $(JAR) $(HTMLDIR)/pub/jgl.jar jgl/*.class \
					       jgl/glu/*.class \
					       jgl/glut/*.class \
					       jgl/glaux/*.class \
					       jgl/context/*.class \
					       jgl/context/attrib/*.class \
					       jgl/context/attrib/eval/*.class \
					       jgl/context/attrib/lighting/*.class \
					       jgl/context/attrib/pixel/*.class \
					       jgl/context/attrib/texture/*.class \
					       jgl/context/clipping/*.class \
					       jgl/context/geometry/*.class \
					       jgl/context/render/*.class \
					       jgl/context/render/pixel/*.class
	@$(CP) Example/*.class $(HTMLDIR)/Example
	@$(CP) Example/*.java $(HTMLDIR)/Example
	@$(CP) Example/*.html $(HTMLDIR)/Example
	@$(CP) Example-glut/*.class $(HTMLDIR)/Example-glut
	@$(CP) Example-glut/*.java $(HTMLDIR)/Example-glut
	@$(CP) Example-glut/alpha*.html $(HTMLDIR)/Example-glut
	@$(CP) Example-glut/hello*.html $(HTMLDIR)/Example-glut
	@$(CP) Example-glut/torus*.html $(HTMLDIR)/Example-glut
	@$(CP) Example-glut/unproject*.html $(HTMLDIR)/Example-glut
	@$(CP) Example-app/*.java $(HTMLDIR)/Example-app
#	@$(CP) Example-gle/*.class $(HTMLDIR)/Example
#	@$(CP) Example-gle/*.java $(HTMLDIR)/Example
#	@$(CP) Example-gle/*.html $(HTMLDIR)/Example
	@$(CP) glut-test/*.class $(HTMLDIR)/glut-test
	@$(CP) glut-test/*.java $(HTMLDIR)/glut-test
	@$(CP) glut-test/*.html $(HTMLDIR)/glut-test
#	@$(CP) Example/Java3D/*.class $(HTMLDIR)/Example/Java3D
#	@$(CP) Example/Java3D/*.java $(HTMLDIR)/Example/Java3D
#	@$(CP) Example/Java3D/*.html $(HTMLDIR)/Example/Java3D
	@cd .. ; $(TAR) \
		$(HTMLDIR)/pub/jgl-$(VERSION).example.tar.gz \
		jgl/Example/README \
		jgl/Example/Make-config \
		jgl/Example/Makefile \
		jgl/Example/make.bat \
		jgl/Example/*.java \
		jgl/Example/*.html \
		jgl/Example/booktest \
		jgl/Example/booktest.bat \
		jgl/Example-glut/README \
		jgl/Example-glut/Make-config \
		jgl/Example-glut/Makefile \
		jgl/Example-glut/make.bat \
		jgl/Example-glut/*.java \
		jgl/Example-glut/alpha.html \
		jgl/Example-glut/alpha3D.html \
		jgl/Example-glut/hello.html \
		jgl/Example-glut/torus.html \
		jgl/Example-glut/unproject.html \
		jgl/Example-glut/booktest \
		jgl/Example-glut/booktest.bat \
		jgl/Example-app/README \
		jgl/Example-app/Make-config \
		jgl/Example-app/Makefile \
		jgl/Example-app/make.bat \
		jgl/Example-app/*.java \
		jgl/Example-app/booktest \
		jgl/Example-app/booktest.bat
#		jgl/Example-gle/Make-config \
#		jgl/Example-gle/Makefile \
#		jgl/Example-gle/make.bat \
#		jgl/Example-gle/*.java \
#		jgl/Example-gle/*.html \
#		jgl/Example-gle/booktest \
#		jgl/Example-gle/booktest.bat \
		jgl/glut-test/README \
		jgl/glut-test/Make-config \
		jgl/glut-test/Makefile \
		jgl/glut-test/make.bat \
		jgl/glut-test/*.java \
		jgl/glut-test/*.html \
		jgl/glut-test/test \
		jgl/glut-test/test.bat
	@cd .. ; $(ZIP) \
		$(HTMLDIR)/pub/jgl-$(VERSION).example.zip \
		jgl/Example/README \
		jgl/Example/Make-config \
		jgl/Example/Makefile \
		jgl/Example/make.bat \
		jgl/Example/*.java \
		jgl/Example/*.html \
		jgl/Example/booktest \
		jgl/Example/booktest.bat \
		jgl/Example-glut/README \
		jgl/Example-glut/Make-config \
		jgl/Example-glut/Makefile \
		jgl/Example-glut/make.bat \
		jgl/Example-glut/*.java \
		jgl/Example-glut/alpha.html \
		jgl/Example-glut/alpha3D.html \
		jgl/Example-glut/hello.html \
		jgl/Example-glut/torus.html \
		jgl/Example-glut/unproject.html \
		jgl/Example-glut/booktest \
		jgl/Example-glut/booktest.bat \
		jgl/Example-app/README \
		jgl/Example-app/Make-config \
		jgl/Example-app/Makefile \
		jgl/Example-app/make.bat \
		jgl/Example-app/*.java \
		jgl/Example-app/booktest \
		jgl/Example-app/booktest.bat
#		jgl/Example-gle/Make-config \
#		jgl/Example-gle/Makefile \
#		jgl/Example-gle/make.bat \
#		jgl/Example-gle/*.java \
#		jgl/Example-gle/*.html \
#		jgl/Example-gle/booktest \
#		jgl/Example-gle/booktest.bat \
		jgl/glut-test/README \
		jgl/glut-test/Make-config \
		jgl/glut-test/Makefile \
		jgl/glut-test/make.bat \
		jgl/glut-test/*.java \
		jgl/glut-test/*.html \
		jgl/glut-test/test \
		jgl/glut-test/test.bat
	@$(CP) $(BACKDIR)/jgl-$(VERSION).src.tar.gz $(HTMLDIR)/pub
	@$(CP) $(BACKDIR)/jgl-$(VERSION).src.zip $(HTMLDIR)/pub
	@chmod 644 $(HTMLDIR)/Example/*.class
	@chmod 644 $(HTMLDIR)/Example/*.java
	@chmod 644 $(HTMLDIR)/Example/*.html
	@chmod 644 $(HTMLDIR)/Example-glut/*.class
	@chmod 644 $(HTMLDIR)/Example-glut/*.java
	@chmod 644 $(HTMLDIR)/Example-glut/*.html
	@chmod 644 $(HTMLDIR)/Example-app/*.java
#	@chmod 644 $(HTMLDIR)/Example-gle/*.class
#	@chmod 644 $(HTMLDIR)/Example-gle/*.java
#	@chmod 644 $(HTMLDIR)/Example-gle/*.html
#	@chmod 644 $(HTMLDIR)/glut-test/*.class
#	@chmod 644 $(HTMLDIR)/glut-test/*.java
#	@chmod 644 $(HTMLDIR)/glut-test/*.html
#	@chmod 644 $(HTMLDIR)/Example/Java3D/*.class
#	@chmod 644 $(HTMLDIR)/Example/Java3D/*.java
#	@chmod 644 $(HTMLDIR)/Example/Java3D/*.html
	@chmod 644 $(HTMLDIR)/pub/*.jar
	@chmod 644 $(HTMLDIR)/pub/*.zip
	@chmod 644 $(HTMLDIR)/pub/*.gz
#	@cd Example/GVS ; $(MAKE) $@
#	@cd Example/Bitmap ; $(MAKE) $@
#	@cd Example/JavaHead ; $(MAKE) $@

backup:
	@cd .. ; $(TAR) $(BACKDIR)/jgl-$(VERSION).backup.tar.gz jgl
#	@cd .. ; $(ZIP) $(BACKDIR)/jgl-$(VERSION).backup.zip jgl

src:
	@cd .. ; $(TAR) $(BACKDIR)/jgl-$(VERSION).src.tar.gz \
		jgl/README \
		jgl/LICENSE \
		jgl/Make-config \
		jgl/Makefile \
		jgl/*.java \
		jgl/glu/Makefile \
		jgl/glu/*.java \
		jgl/glut/Makefile \
		jgl/glut/*.java \
		jgl/glaux/Makefile \
		jgl/glaux/*.java \
		jgl/gle/Makefile \
		jgl/gle/*.java \
		jgl/gle/render/Makefile \
		jgl/gle/render/*.java \
		jgl/gle/geometry/Makefile \
		jgl/gle/geometry/*.java \
		jgl/glj3d/Makefile \
		jgl/glj3d/*.java \
		jgl/context/Makefile \
		jgl/context/*.java \
		jgl/context/attrib/Makefile \
		jgl/context/attrib/*.java \
		jgl/context/attrib/eval/Makefile \
		jgl/context/attrib/eval/*.java \
		jgl/context/attrib/lighting/Makefile \
		jgl/context/attrib/lighting/*.java \
		jgl/context/attrib/pixel/Makefile \
		jgl/context/attrib/pixel/*.java \
		jgl/context/attrib/texture/Makefile \
		jgl/context/attrib/texture/*.java \
		jgl/context/clipping/Makefile \
		jgl/context/clipping/*.java \
		jgl/context/geometry/Makefile \
		jgl/context/geometry/*.java \
		jgl/context/render/Makefile \
		jgl/context/render/*.java \
		jgl/context/render/pixel/Makefile \
		jgl/context/render/pixel/*.java \
		jgl/Example/README \
		jgl/Example/Make-config \
		jgl/Example/Makefile \
		jgl/Example/make.bat \
		jgl/Example/*.java \
		jgl/Example/*.html \
		jgl/Example/booktest \
		jgl/Example/booktest.bat \
		jgl/Example-glut/README \
		jgl/Example-glut/Make-config \
		jgl/Example-glut/Makefile \
		jgl/Example-glut/make.bat \
		jgl/Example-glut/*.java \
		jgl/Example-glut/alpha.html \
		jgl/Example-glut/alpha3D.html \
		jgl/Example-glut/hello.html \
		jgl/Example-glut/quadric.html \
		jgl/Example-glut/scene.html \
		jgl/Example-glut/texbind.html \
		jgl/Example-glut/texsub.html \
		jgl/Example-glut/texture3d.html \
		jgl/Example-glut/torus.html \
		jgl/Example-glut/unproject.html \
		jgl/Example-glut/booktest \
		jgl/Example-glut/booktest.bat \
		jgl/Example-app/README \
		jgl/Example-app/Make-config \
		jgl/Example-app/Makefile \
		jgl/Example-app/make.bat \
		jgl/Example-app/*.java \
		jgl/Example-app/booktest \
		jgl/Example-app/booktest.bat \
		jgl/Example-gle/Make-config \
		jgl/Example-gle/Makefile \
		jgl/Example-gle/make.bat \
		jgl/Example-gle/*.java \
		jgl/Example-gle/*.html \
		jgl/Example-gle/booktest \
		jgl/Example-gle/booktest.bat \
		jgl/glut-test/README \
		jgl/glut-test/Make-config \
		jgl/glut-test/Makefile \
		jgl/glut-test/make.bat \
		jgl/glut-test/*.java \
		jgl/glut-test/*.html \
		jgl/glut-test/test \
		jgl/glut-test/test.bat
	@cd .. ; $(ZIP) $(BACKDIR)/jgl-$(VERSION).src.zip \
		jgl/README \
		jgl/LICENSE \
		jgl/Make-config \
		jgl/Makefile \
		jgl/*.java \
		jgl/glu/Makefile \
		jgl/glu/*.java \
		jgl/glut/Makefile \
		jgl/glut/*.java \
		jgl/glaux/Makefile \
		jgl/glaux/*.java \
		jgl/gle/Makefile \
		jgl/gle/*.java \
		jgl/gle/render/Makefile \
		jgl/gle/render/*.java \
		jgl/gle/geometry/Makefile \
		jgl/gle/geometry/*.java \
		jgl/glj3d/Makefile \
		jgl/glj3d/*.java \
		jgl/context/Makefile \
		jgl/context/*.java \
		jgl/context/attrib/Makefile \
		jgl/context/attrib/*.java \
		jgl/context/attrib/eval/Makefile \
		jgl/context/attrib/eval/*.java \
		jgl/context/attrib/lighting/Makefile \
		jgl/context/attrib/lighting/*.java \
		jgl/context/attrib/pixel/Makefile \
		jgl/context/attrib/pixel/*.java \
		jgl/context/attrib/texture/Makefile \
		jgl/context/attrib/texture/*.java \
		jgl/context/clipping/Makefile \
		jgl/context/clipping/*.java \
		jgl/context/geometry/Makefile \
		jgl/context/geometry/*.java \
		jgl/context/render/Makefile \
		jgl/context/render/*.java \
		jgl/context/render/pixel/Makefile \
		jgl/context/render/pixel/*.java \
		jgl/Example/README \
		jgl/Example/Make-config \
		jgl/Example/Makefile \
		jgl/Example/make.bat \
		jgl/Example/*.java \
		jgl/Example/*.html \
		jgl/Example/booktest \
		jgl/Example/booktest.bat \
		jgl/Example-glut/README \
		jgl/Example-glut/Make-config \
		jgl/Example-glut/Makefile \
		jgl/Example-glut/make.bat \
		jgl/Example-glut/*.java \
		jgl/Example-glut/alpha.html \
		jgl/Example-glut/alpha3D.html \
		jgl/Example-glut/hello.html \
		jgl/Example-glut/quadric.html \
		jgl/Example-glut/scene.html \
		jgl/Example-glut/texbind.html \
		jgl/Example-glut/texsub.html \
		jgl/Example-glut/texture3d.html \
		jgl/Example-glut/torus.html \
		jgl/Example-glut/unproject.html \
		jgl/Example-glut/booktest \
		jgl/Example-glut/booktest.bat \
		jgl/Example-app/README \
		jgl/Example-app/Make-config \
		jgl/Example-app/Makefile \
		jgl/Example-app/make.bat \
		jgl/Example-app/*.java \
		jgl/Example-app/booktest \
		jgl/Example-app/booktest.bat \
		jgl/Example-gle/Make-config \
		jgl/Example-gle/Makefile \
		jgl/Example-gle/make.bat \
		jgl/Example-gle/*.java \
		jgl/Example-gle/*.html \
		jgl/Example-gle/booktest \
		jgl/Example-gle/booktest.bat \
		jgl/glut-test/README \
		jgl/glut-test/Make-config \
		jgl/glut-test/Makefile \
		jgl/glut-test/make.bat \
		jgl/glut-test/*.java \
		jgl/glut-test/*.html \
		jgl/glut-test/test \
		jgl/glut-test/test.bat

include Make-config
